import re
print (re.sub(r'(?=(\d{3})+)',',','12345'))
print (re.sub(r'(?=(\d{3})+(?!\d))',',','12345'))
print (re.sub(r'(?!\d)',',','12345'))

print (re.sub(r'(?=(\d{2})+)',',','12345'))
print (re.sub(r'(?=(\d{1})+)',',','12345'))

print ('---------------------')    
print (re.sub(r'(?=(\d{3})+)',',','123456'))
print (re.sub(r'(?=(\d{3})+(?!\d))',',','123456'))
print (re.sub(r'(?!\d)',',','123456'))

print (re.sub(r'(?=(\d{2})+)',',','123456'))
print (re.sub(r'(?=(\d{6})+)',',','123456'))
print ('---------------------')  
print (re.sub(r'(?\d{2})',',','4123'))
